{extend  name="Index/index" /}
{block name="main"}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">用户列表</div>
                </div>
                <div class="widget-body  am-fr">
                    <form class="am-form tpl-form-border-form tpl-form-border-br" method="post">
                        <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                            <div class="am-form-group tpl-table-list-select ">
                                <select data-am-selected="{btnSize: 'sm'}">
                                    <option value="option1">已报名</option>
                                    <option value="option2">未报名</option>
                                    <option value="option2">上课中</option>
                                </select>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                            <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                <input type="text" class="am-form-field ">
                                <span class="am-input-group-btn">
                                <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"
                                        type="button"></button>
                                </span>
                            </div>
                        </div>
                    </form>
                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                            <tr>
                                <th class="am-text-middle">头像</th>
                                <th class="am-text-middle">用户名</th>
                                <th class="am-text-middle">姓名</th>
                                <th class="am-text-middle">电话</th>
                                <th class="am-text-middle">状态</th>
                                <th class="am-text-middle">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="data" id="user"}
                            <tr class="gradeX">
                                <td>
                                    {switch name="$user.uimg"}
                                    {case value=""}
                                    <img src="/static/admin/main/assets/img/k.jpg" class="tpl-table-line-img" alt="">
                                    {/case}
                                    {default /}
                                    <img src="/uploads/{$user.uimg}" class="tpl-table-line-img" alt="用户头像">
                                    {/switch}
                                </td>
                                <td class="am-text-middle">{$user.username}</td>
                                <td class="am-text-middle">{$user.uname}</td>
                                <td class="am-text-middle">{$user.utel}</td>
                                <td class="am-text-middle">
                                    {switch name="$user.status" }
                                    {case value="0"}未报名{/case}
                                    {case value="1"}已报名{/case}
                                    {case value="2"}上课中{/case}
                                    {/switch}
                                </td>
                                <td class="am-text-middle">
                                    <div class="tpl-table-black-operation">
                                        <a href="javascript:;" class="myedit">
                                            <i class="am-icon-pencil" data-id="{$user.uid}"></i> 编辑
                                        </a>
                                        <a href="javascript:;" class="tpl-table-black-operation-del {if condition="in_array($user.uid,$uid)"}"{/if} myblack" data-id="{$user.uid}">
                                            <i class="am-icon-close"></i>
                                            {if condition="in_array($user.uid,$uid)"}已加入黑名单
                                            {else /} 加入黑名单
                                            {/if}
                                        </a>
                                    </div>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">

                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">
                                <li class="am-disabled"><a href="#">«</a></li>
                                <li class="am-active"><a href="#">1</a></li>
                                <li><a href="#">2</a></li>
                                <li><a href="#">3</a></li>
                                <li><a href="#">4</a></li>
                                <li><a href="#">5</a></li>
                                <li><a href="#">»</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="myjs"}
<script>
    $(function () {
        $('.myedit').click(function () {
            var myedit = $(this);
            var uid = myedit.find('i').attr('data-id');
            console.log(uid);
            $.ajax({
                type: 'get',
                dataType: 'html',
                data: {
                    'uid':uid
                },
                url: "{:url('admin/User/edit')}",
                success: function (data) {
                    $('.mycontent').html(data);
                }
            });
        });
        $('.myblack').click(function () {
            var myblack = $(this);
            var uid = $(this).attr('data-id');
            $.ajax({
                type: 'get',
                dataType: 'html',
                data: {
                    'uid':uid
                },
                url: "{:url('admin/User/dodel')}",
                success: function (data) {
                    if(data){
                        myblack.hide();
                    }
                }
            });
        });
//        $('.myblack').click(function () {
//            var myblack = $(this);
//            var uid = $(this).attr('data-id');
//            $.ajax({
//                type: 'get',
//                dataType: 'html',
//                data: {
//                    'uid':uid
//                },
//                url: "{:url('admin/User/dodel')}",
//                success: function (data) {
//                    if(data){
//                        myblack.hide();
//                    }
//                }
//            });
//        });
    });
</script>
{/block}

